package cn.gson.springboot.controller;

import cn.gson.springboot.model.pojos.Department;
import cn.gson.springboot.model.pojos.Job;
import cn.gson.springboot.model.service.DepartmentService;
import cn.gson.springboot.model.service.JobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class JobController {
    @Autowired
    JobService jobService;

    @RequestMapping("/job-list")
    @ResponseBody
    //查询所有职位
    public List<Job> findAllDept(){

        return jobService.findAllJob();
    }
    @RequestMapping("/dept-job-list")
    @ResponseBody
    public List<Job> findDeptJob(Integer deptId){
        return jobService.findDeptJob(deptId);
    }

    @RequestMapping("/save-job")
    @ResponseBody
    public void saveJob(@RequestBody Job job){
        jobService.saveJob(job);
    }

    @RequestMapping("/delete-job")
    @ResponseBody
    public void deleteJob(Integer jobId){
        jobService.deleteJob(jobId);
    }
}
